﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using PatientManagement.DAL.Interfaces;
using PatientManagement.DAL.Database;
using System.Diagnostics;

namespace PatientManagement.DAL.DAL
{
    public class PatientDataAccessLayer: IDataAccessLayer
    {
        public bool AddPatient(Common.ObjectModels.Patient patient)
        {
            try
            {
                using (var context = new PatientManagementDataContext())
                {
                    int result = context.AddPatient(patient.Name, patient.Address, 
                        patient.Birthday, patient.PhoneNumber, patient.Sex);
                    return result != 0 ? false : true;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                return false;
            }
        }

        public bool AddDrug(Common.ObjectModels.Drug drug)
        {
            throw new NotImplementedException();
        }
    }
}
